package game.state.menu.ui;

import engine.input.Mouse;

public class Button 
{
    
    private int x1;
    private int y1;
    private int x2;
    private int y2;
    
    public Button(int x1pos, int y1pos, int x2pos, int y2pos) 
    {
        x1 = x1pos;
        y1 = y1pos;
        x2 = x2pos;
        y2 = y2pos;
    }
    
    public boolean wasPressedBy(Mouse mouse) 
    {
        return (contains(mouse.mx(), mouse.my()) && mouse.wasReleased(Mouse.CLICK_L));
    }
    
    public boolean contains(int xpos, int ypos) 
    {
        return (xpos < x2 && xpos >= x1 && ypos < y2 && ypos >= y1);
    }
    
}
